<?php

namespace app\v1\controller;

use think\Controller;
use think\Request;
use think\Validate;

/**
 * Class Message
 * @package app\v1\controller
 * 验证码控制器模块
 */
class Message extends Controller
{
    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
    public function sendSm()
    {
        $phone=input('phone',null);

        $validate=new Validate([
            'phone'=>'require|length:11'

        ]);
        $validate->message([
            'phone.require'=>'请填写手机号码',
            'phone.length'=>'请填写正确的手机号号码'

        ]);
        $data=$this->request->post();
        if(!$validate->check($data)){
            renderInfo(400001,$validate->getError());
        }
        $isPhone=isPhone($phone);

        if(!$isPhone){
            renderInfo(400001,'请填写正确的手机号号码');
        }
        $message=model('v1/Message');
        $message->sendSm($phone);
    }


}
